define(['text!service/warrantyCard.html', '../service/data/appliancesList'],
	function(viewTemplate, Appliances) {
		return Piece.View.extend({
			id: 'service_warrantyCard',

			events: {
				"click #add": "submit",
				"click .list-st": "detail",
			},
			render: function() {
				$(this.el).html(viewTemplate);

				Piece.View.prototype.render.call(this);
				return this;
			},
			onShow: function() {
				//write your business logic here :)


				var windowHeight = $(window).height();
				var elTop = $("#warrantyCard").offset().top;
				var elHeight = windowHeight - elTop;

				console.info(elHeight);
				$("#warrantyCard").css({
					"height": elHeight
				});
				new iScroll($("#warrantyCard")[0]);

				this.TempviewlateRender(Appliances);

				// $("#warrantyCard")[0].refresh();

			},
			detail: function() {


				this.container.navigateForResult('/service/warrantyCard2', {
					trigger: true
				}, 'service/warrantyCard', this.onGotResult);
			},
			submit: function() {


				this.container.navigateForResult('/service/addwarrantyCard', {
					trigger: true
				}, 'service/warrantyCard', this.onGotResult);
			},


			//模板页面渲染

			TempviewlateRender: function(data) {

				var listTemplateWiki = _.template($("#warrantycardTemp").html(), {
					"rows": data.rows
				});

				$("#warrantycardList").append(listTemplateWiki);


				// new iScroll($("#standards"));
			},
		}); //view define

	});